package com.wry.spring.extension;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * <h1> ApplicationContext-也就是IOC容器 </h1>
 *
 * @author wry
 * @since 2025.04.06
 */
@Component
public class MyApplicationContextAware implements ApplicationContextAware {

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        Object orderServiceImpl = applicationContext.getBean("orderServiceImpl");
        System.out.println("ApplicationContextAware:" + orderServiceImpl);

        Object user = applicationContext.getBean("user");
        System.out.println("BeanFactoryPostProcessor -> 扩展点的user=" + user);
    }
}
